<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.*,util.*,model.*,control.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>处理</title>
</head>
<body>
<%
	request.setCharacterEncoding("utf-8");	
	//int id =Integer.parseInt(request.getParameter("id"));
	int id = ParamUtil.getInt(request,"id",0);
	double aa = ParamUtil.getDouble(request,"aa",0.0);
	double bb = ParamUtil.getDouble(request,"bb",0.0);
	double cc = ParamUtil.getDouble(request,"cc",0.0);
	String correct = ParamUtil.getString(request,"correct");
	String chapter = ParamUtil.getString(request,"chapter");
    String section = ParamUtil.getString(request,"section");
    float mark = ParamUtil.getFloat(request,"mark",(float)0.0);
    float abilityRange = ParamUtil.getFloat(request,"abilityRange",(float)0.0);
    String flag_pic = ParamUtil.getString(request,"flag_pic","0");
    String flag_med = ParamUtil.getString(request,"flag_med","0");    
    String author = ParamUtil.getString(request,"author");
    String lastTime = ParamUtil.getString(request,"lastTime","2011-01-01");
    double flag = ParamUtil.getDouble(request,"flag",0.0);
    String alt1 = ParamUtil.getString(request,"alt1");
	String content = request.getParameter("testfck");
	String A = request.getParameter("A");
	String B = request.getParameter("B");
	String C = request.getParameter("C");
	String D = request.getParameter("D");


	
	
	
	Problem problem = new Problem();
	ProblemControl pc = new ProblemControl();
	
	problem.setContent(content);
	problem.setA(A);
	problem.setB(B);
	problem.setC(C);
	problem.setD(D);
	problem.setAa(aa);
	problem.setBb(bb);
	problem.setCc(cc);
	problem.setCorrect(correct);
	problem.setChapter(chapter);
	problem.setSection(section);
	problem.setMark(mark);
	problem.setAbilityRange(abilityRange);
	problem.setFlag_pic(flag_pic);
	problem.setFlag_med(flag_med);
	problem.setAuthor(author);
	problem.setFlag(flag);
	problem.setAlt1(alt1);
	problem.setLastTime(lastTime);
	
	
	if(pc.updateProblem(problem,id))
	{
	%>
<script language="javascript">
     alert("修改成功");
     window.location.href="problem_list.jsp";
    </script>
<%
	} else { 
	%>
<script language="javascript">
     alert("修改失败");
     window.location.href="problem_update.jsp?id=<%=id%>";
    </script>
<%} %>
</body>
</html>
